// Problem: 
// Contest: 
// URL: 
// Memory Limit: 
// Time Limit: 
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include<bits/stdc++.h>
using namespace std;
#define int long long
inline int read(){
	int s=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
	while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
	return s*w;
}
struct pos
{
	int x,y,c;
	pos(int xx,int yy,int cc)
	{
		x=xx,y=yy,c=cc;
	}
};
int dx[8]={2,2,1,1,-1,-1,-2,-2};
int dy[8]={1,-1,2,-2,2,-2,1,-1};
signed main()
{
	int n,m,a,b;
	cin>>n>>m>>a>>b;
	vector<vector<int>> v(n+1,vector<int>(m+1));
	vector<vector<int>> vis(n+1,vector<int>(m+1));
	queue<pos> q;
	q.push(pos(a,b,0));
	while(!q.empty())
	{
		pos tmp=q.front();
		q.pop();
		int x=tmp.x,y=tmp.y,c=tmp.c;
		if(x<1||x>n||y<1||y>m||vis[x][y])continue;
		vis[x][y]=c;
		for(int i=0;i<8;i++)
		{
			q.push(pos(x+dx[i],y+dy[i],c+1));
		}
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			if(i==a&&j==b)printf("%-5d",0);
			else if(vis[i][j]==0)printf("%-5d",-1);
			else printf("%-5lld",vis[i][j]);
		}
		cout<<endl;
	}
		
	return 0;
}
